package com.example.tests;

import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.*;

import java.util.Random;
import org.testng.annotations.Test;

import com.example.utils.SortedListOf;

public class GroupRemovalTests extends TestBase {
	
	@Test
	public void deleteSomeGroup(){
		// save old state
		SortedListOf<GroupData> oldList = app.getModel().getGroups();
		
		Random rnd 	= new Random();
		int indx	= rnd.nextInt(oldList.size() - 1);
		// action
		app.getGroupHelper().deleteGroup(indx);

		// save new state
		SortedListOf<GroupData> newList = app.getModel().getGroups();
		
		// compare state
		assertThat(newList, equalTo(oldList.without(indx)));
	}
}
